<div class="hover">
  <table>
  {#if top_class_indices}
    {#each top_class_indices.slice(0,5) as top, i}
      <tr>
        <td style="width: 10px; text-align: right; padding-right: 4px;">{i + 1}.</td>
        <td class="{i == 0 ? 'first': ''}">{$inceptionLabels[top]}</td>
        <td style="text-align: right;">{format(top_class_values[i])}</td>
      </tr>
    {/each}
  {/if}
  </table>
  <div style="font-size: 10px; margin-top: 4px; color: #999; text-align: right;">Average of {formatLarge(num_activations)} activations</div>

</div>

<script>
  import {format} from "d3-format";

  export default {
    helpers: {
      format: format(".2f"),
      formatLarge: format(",")
    }
  }
</script>

<style>
.hover {
  margin: 30px;
  color: white;
  font-size: 12px;
  line-height: 14px;
  background: rgba(0, 0, 0, 0.8);
  padding: 8px;
  border-radius: 6px;
  border: solid 1px rgba(255, 255, 255, 0.4);
  box-sizing: border-box;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
  z-index: 10000;
}
.hover table {
  width: 100%;
  margin-bottom: 0;
}
.hover td {
  font-size: 12px;
  border-bottom: solid 1px rgba(255, 255, 255, 0.2);
  padding: 6px 0;
  margin: 6px 0;
  color: rgba(255, 255, 255, 0.8);
  overflow: ellipsis;
}
.hover td.first {
  color: rgba(255, 255, 255, 1.0);
  font-weight: bold;
}

.icon {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 4px;
  border: solid 3px black;
  pointer-events: none;
  box-sizing: border-box;
}
</style>